package com.test.practice.exception;

import java.util.InputMismatchException;
import java.util.Scanner;

/**
 * @Description:
 * =======================
 * @Author: Jovi
 * =======================
 * @Date: Created in 2020/9/24
 * =======================
 * @Version: 0.0.1
 */
public class FirstClass {
    public static void main(String[] args) {
        try {
            SecondClass.sm();
        } catch (Exception e) {
            e.printStackTrace();
            System.err.println("最顶层异常catch");
        }
    }
}

class SecondClass {
    public static void sm() throws Exception {
        try {
            ThirdClass.tm();
        } catch (InputMismatchException e) {
            System.err.println("二级异常");
            throw new MyException("我的异常");
        }
    }
}

class ThirdClass {
    static void tm(){
        Scanner in = new Scanner(System.in);
        System.out.println("请输入：");
        int num1 = in.nextInt();
        System.out.println("请输入：");
        int num2 = in.nextInt();
        System.out.println(num1 + "/" + num2 + "=" + num1 / num2);
    }
}
